/**
 * @Author: Lenovo
 * @Date: 2024/6/8 22:12
 * @description:
 */
/*class MyArray{
    public Object[]array=new Object[10];
    public void setVal(int pos,Object val){
        this.array[pos]=val;
    }
    public Object getVal(int pos){
        return array[pos];
    }
}*/
/*class MyArray<E>{
    public Object[]array=new Object[10];
    public void setVal(int pos,E val){
        this.array[pos]=val;
    }
    public E getVal(int pos){
        return (E) array[pos];
    }
}*/
class MyArray<E extends Number>{
    public Object[]array=new Object[10];
    public void setVal(int pos,E val){
        this.array[pos]=val;
    }
    public E getVal(int pos){
        return (E) array[pos];
    }
}
public class Test {
    public static void main(String[] args) {

    }
    public static void main3(String[] args) {
        /*MyArray<Integer>myArray = new MyArray<>();
        MyArray<String>myArray1=new MyArray<String>();
        myArray.setVal(0,10);
        myArray.setVal(1,20);
        System.out.println(myArray.getVal(1));*/
    }
    public static void main2(String[] args) {
        MyArray<Integer>myArray=new MyArray<>();
        myArray.setVal(0,10);
        myArray.setVal(1,20);
        //myArray.setVal(1,'s');
        System.out.println(myArray.getVal(1));
    }
    public static void main1(String[] args) {
        /*MyArray myArray=new MyArray();
        myArray.setVal(1,1);
        myArray.setVal(2,"hello");
        String ret=(String) myArray.getVal(2);
        System.out.println(ret);*/
    }
}
